<%@page contentType="text/html; charset=utf-8"%>
<%@include file="/WEB-INF/views/common/taglibs.jspf" %>
<title>系统用户管理</title>

<link rel="stylesheet" href="${ctx}/static/admin/ace/css/jquery-ui.css" />


<div class="row">
	<div class="col-xs-12">
		<!-- PAGE CONTENT BEGINS -->
		
		<div class="btn-group">
			<button id="add-bto" class="btn btn-primary btn-sm">
				<i class="glyphicon glyphicon-plus"></i>添加
			</button>
			<button id="edit-bto" class="btn btn-info btn-sm">
				<i class="ace-icon fa fa-pencil-square-o"></i>编辑
			</button>
			<button id="del-bto" class="btn btn-danger btn-sm">
				<i class="ace-icon fa fa-trash"></i>删除
			</button>
			<button id="search-bto" class="btn btn-purple btn-sm">
				<i class="ace-icon fa fa-search"></i>搜索
			</button>
			<button id="reload-bto" class="btn btn-success btn-sm">
				<i class="ace-icon fa fa-refresh"></i>刷新
			</button>
		</div>
		
		<div id="form">
			<div class="form-group">
				<label class="col-sm-3 control-label no-padding-right" for="form-field-1-1"> Full Length </label>

				<div class="col-sm-9">
					<input type="text" id="form-field-1-1" placeholder="Text Field" class="form-control" />
				</div>
			</div>
		</div>
		
		
		


		<!-- PAGE CONTENT ENDS -->
	</div><!-- /.col -->
</div><!-- /.row -->


<!--
[if lte IE 8]>
  <script src="${ctx}/static/admin/ace/js/excanvas.js"></script>
<![endif]
-->
<script type="text/javascript">
var scripts = [null, "${ctx}/static/admin/ace/js/jquery-ui.js", null];
$('.page-content-area').ace_ajax('loadScripts', scripts, function() {
  
	jQuery(function($) {
		
		$("#add-bto").click(function() {
			var ii = layer.load(0, {shade : [0.3]});
			$.ajax({
				url: "${ctx}/admin/sys/user/form", cache:false
			}).error(function(event, XMLHttpRequest, ajaxOptions, thrownError){
				if(event.status == 404) { }
			}).done(function(result){
				layer.close(ii);
				/* layer.open({
				    type: 2,
				    title: 'layer mobile页',
				    shadeClose: true,
				    shade: 0.8,
				    area: ['380px', '450px'],
				    content: 'http://layer.layui.com/mobile/' //iframe的url
				});  */
				layer.open({
				    type: 1, //page层
				    area: ['900px', '500px'],
				    title: '你好，layer。',
				    skin: 'layui-layer-molv', //墨绿风格
				    shade: 0.6, //遮罩透明度
				    shift: 1, //0-6的动画形式，-1不开启
				    scrollbar: false, //禁用浏览器滚动条
				    content: result,
				    success: function(layero, index){
				        console.info(layero, index);
				    },
				    btn: ['按钮一', '按钮二', '按钮三', '按钮四']
				    ,yes: function(index, layero){
				        //按钮【按钮一】的回调
				    },cancel: function(index){
				        //按钮【按钮二】的回调
				    },btn3: function(index, layero){
				        //按钮【按钮三】的回调
				    },btn4: function(index, layero){
				        //按钮【按钮三】的回调
				    }
				}); 
				
				//layer.open({content: result});
			});
		});
		
		/* 
		var dialog = null ;
		$("#add-bto").on("click", function(){
			dialog = $.dialog({
				id: "addDialog", title: "<i class='ace-icon ace-icon fa fa-refresh green bigger-100'></i> 加载中...",
				lock: true, 
				padding: "10px",
		        cancel:function(){},
			    okVal:'提交',
				ok:function(){
			        add();
			        return false;
			    }
			});
			$.ajax({
				url: "${ctx}/admin/sys/user/form", cache:false
			}).error(function(event, XMLHttpRequest, ajaxOptions, thrownError){
				if(event.status == 404) {dialog.close();$.dialog.tips("404请求地址不正确！", 2, "fa-times red"); }
			}).done(function(result){
				dialog.content(result).title("<i class='ace-icon ace-icon fa fa-plus green bigger-100'></i> 添加用户");
			});
		});
		
		function add() {
			$.dialog.tips('数据提交中...',600,'fa-spinner fa-spin orange').lock();
			var data = $.shine.serializeObject("#main-form");
			
			$.ajax({
				type: "POST",
				url: "${ctx}/admin/sys/user/add",
				data: data, dataType: "JSON",
			}).error(function(event, XMLHttpRequest, ajaxOptions, thrownError){
				$.dialog.tips("发生错误", 2, "fa-times red"); 
			}).done(function(result){
				if(result.error != null  && result.error != undefined) {
					$.dialog.tips("数据保存发生错误！", 1, "fa-times red"); 
					
				} else {
					$.dialog.tips(result.message,2,'fa-check green',function(){ dialog.close(); });
				}
				
			});
		}
		*/
		
	});
});
</script>
